/*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 3 of the License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.


See LICENSE and AUTHORS for more information.
*/

#ifndef CONNECTTOCOREDIALOG_H
#define CONNECTTOCOREDIALOG_H

#include <QWidget>
#include "ui_connecttocoredialog.h"
#include <QHash>
#include <QString>
#include <QVariant>
#include <QSettings>

class QLabel;

/**
* @class ConnectToCoreDialog
* @brief the dialog to select the core-account and initiate connection
*
* This dialog reads the available accounts from the settings file
* and offers the user a list to select from. Accounts can be selected
* and edited as well as newly added.
*/
class ConnectToCoreDialog : public QWidget
{
    Q_OBJECT
public:
    ConnectToCoreDialog();
    Ui_ConnectToCoreDialog *form;
    void setErrorString(QString);
private slots:
    void doConnect();
    void selectionChanged();
    void itemChanged(QListWidgetItem* item);

signals:
    void startConnect(QString,QString,QString,QString);
private:
    QHash<QString,QHash<QString,QVariant> > accs;
    QString inEdit;
    QSettings* settings;
    QLabel *errLabel;
};

#endif // CONNECTTOCOREDIALOG_H
